//= require social_stream/callback

SocialStream.Audio = (function(SS, $, undefined){
  var callback = new SS.Callback();

  var initJplayer = function(){
    $(".jp-audio .jp-jplayer").each(function() {
      var container = $(this).closest('.audio-container');

      $(this).jPlayer({
        ready: function () {
          $(this).jPlayer("setMedia", {
            webma: container.attr("data-url-webma")
          });
        },
      preload: "none",
      supplied: "webma",
      swfPath: container.attr('data-url-swfplayer'),
      cssSelectorAncestor: "#" + container.attr("id")
      })
    });
  }

  callback.register('show', initJplayer);

  return callback.extend({
  });

})(SocialStream, jQuery);
